home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 42 / q42.d81 / t.maze 80 < prev    next >
Text File  |  2022-08-28  |  4KB  |  93 lines

  1.  
  2.  
  3.                                M A Z E   8 0
  4.  
  5.                       Program and Text by John Murphy
  6.  
  7.  
  8.  NOTE: You can run MAZE 80 from the LOADSTAR menu but it doesn't return to
  9. LOADSTAR.
  10.  
  11.     Maze 80 is a building block for anyone who would like to create their
  12. own maze programs using the 80-column screen on the C128. I developed Maze
  13. 80 while I was writing Maze Master 128. I needed to get the basic maze
  14. creation, display and movement working before I could do any of the fancy
  15. stuff, like making the maze hidden or invisible.
  16.  
  17.     There are two parts to the program, a machine language routine that
  18. creates the maze and the BASIC program that displays the maze and handles
  19. character movement. An integral part of the BASIC program is the Control
  20. 80-C toolkit. C80C provides the PEER and POST commands that are used to
  21. manipulate screen memory for the 80 column screen. It also has commands for
  22. moving data in and out of screen memory and color memory on the 80 column
  23. chip.
  24.  
  25.     The ML maze generator is an adaptation of an ML program for the C64
  26. that was published in Compute!'s Machine Language Routines for the
  27. Commodore 64. The routine was originally written by Gary E. Marsa for the
  28. PET and the VIC 20 as a machine language implementation of a maze
  29. generating routine created by Charles Bond in BASIC. The C64 translation
  30. was done by Gregg Peele for Compute! magazine. Source code for the ML
  31. routine is provided in EBUD format.
  32.  
  33.     The original ML routine created the maze in screen memory. My ML skills
  34. were not up to doing this on the 8563 chip, so I cheated. I modified the
  35. routine to create the maze in a section of memory that is set aside by the
  36. GRAPHIC command that is used to initialize the mouse version of Control 80-
  37. C. After the maze is complete I use the STORE and RECALL commands provided
  38. by C80C to move the maze into screen memory. Once that is done PEER and
  39. POST commands can be used to work with the maze in screen memory.
  40.  
  41.     You can change the character representing the wall with the following:
  42.  
  43.  POKE(DEC("2F24")),WL:POKE(DEC("2F79"),WL
  44.  
  45. where WL is the screen code for the wall character. Use the same codes that
  46. you would use with the FILL command in C80C. You should do this before you
  47. call the ML routine to create the maze. You should also clear the 80 column
  48. screen and then STORE a copy of the screen with the following:
  49.  
  50.  STORE 2048,0,12288,0
  51.  
  52. Use SYS 12032 to call the maze generator. The routine will generate the
  53. maze in memory starting at 12288. You can change the color of the walls
  54. with:
  55.  
  56.  FILL 2048,79,24,12
  57.  
  58. This will change the color of the walls from the default foreground color
  59. to brown. You then need to move the maze from memory into the screen memory
  60. of the 80-column chip using:
  61.  
  62.  RECALL 2048,0,12288,0
  63.  
  64. This will display the maze on the screen. If you want to have an exit from
  65. the maze you can POST a space in the upper left corner of the maze or
  66. wherever you choose.
  67.  
  68.     The rest of the program is pretty straight-forward BASIC code for
  69. reading the keyboard and the joystick, then moving the little ball
  70. character around the screen. There is also a routine at the end of the
  71. program for having the ball character appear to run around and solve the
  72. maze. This is taken from Charles Bond's original program.
  73.  
  74.     Hopefully, Maze 80 will give you the tools and the incentive to write
  75. your own maze games for the 80-column screen. And to share them with
  76. everyone else.
  77.  
  78.  
  79.  FENDER'S POSTMUMBLE: To me, it's amazing that the logic to generate the
  80. maze is contained in 125 lines of ML code, and the logic to do the demo in
  81. 6 lines of BASIC code. I remember once writing an algorithm for moving a
  82. ball around on the screen and it was something like 20 lines long. And it
  83. didn't do anything as neat as find a way through a maze, remembering where
  84. it has gone.
  85.  
  86.  Off the top of my head it seems like the ML routine could be improved by
  87. having the size of the maze adjustable by the programmer who uses it. I'm
  88. putting the EBUD source code on the issue in case any Machine Language
  89. maven would like to make the generator more powerful.
  90.  
  91.                    \\\\\ R - Run   RETURN - Menu \\\\\
  92.  
  93.